var echartUtil={//页面总变量
		//柱状图模板
		barChartTemp:function(div,titleText,legendValue,xVlue,sValue,show){
			 var myChart = echarts.init(document.getElementById(div));
			    myChart.setOption({
			        title: {
			        	text: titleText,
			        	x:'center',
			            y: 'top'
			        },
			        toolbox: {
			            show: true,
			            orient: 'vertical',
			            left: 'right',
			            top: 'center',
			            feature: {
			                mark: {show: true},
			                dataView: {show: true, readOnly: false},
			                magicType: {show: true, type: ['line', 'bar', 'stack', 'tiled']},
			                restore: {show: true},
			                saveAsImage: {show: true}
			            }
			        },
			        tooltip: {
			        	 formatter: '{c}'+show
			        },
			        legend: {
		                orient: 'horizontal',
				        x: 'center',
				        y: 'bottom',
				        data:legendValue
			        },
			        xAxis: {
			            data: xVlue
			        },
			        yAxis:  [
			        	{ 
			                axisLabel: {
			                    formatter: '{value}'+show
			                }
			            }
			        ],
			        series:  [{
		                name: legendValue,
		                type: 'line',
		                data: sValue,
		                itemStyle: {
		                    normal: {
		                        label: {
		                            show: true,
		                            positiong: 'top',
		                            formatter: '{c}'+show
		                        }
		                    }
		                }
		            }]
			    });
		},
		getManager:function(deptName){
			if(deptName==''){
				var html="<tr><td>车间名称</td><td>无</td><td>主管姓名</td><td>无</td>"
				  +"<td>手机号码</td><td>无</td></tr>";
				$("#managerTable").html(html);
				$("img").attr("src",'img/xx.png');
				return false;
			}
			$.ajax({
				url:'user/getManager',
				data:{
					'workShop':deptName
				},
				success:function(data){
					if(data.result){
						data=data.data;
						html="<tr><td>车间名称</td><td>"+data.workShop
							      +"</td><td>主管姓名</td><td>"+data.userName+"</td>"
								  +"<td>手机号码</td><td>"+data.phone+"</td></tr>";
						$("#managerTable").html(html);
						$("img").attr("src",data.avatar);
					}else{
						layAlert(data.info);
					}
				 }
			   }
			);
		},
		getTopManager:function(){
			$.ajax({
				url:'../user/getManager',
				data:{
					'workShop':deptName
				},
				success:function(data){
					if(data.result){
						data=data.data;
						html="<tr><td>车间名称</td><td>"+data.workShop
							      +"</td><td>主管姓名</td><td>"+data.userName+"</td>"
								  +"<td>手机号码</td><td>"+data.phone+"</td>"
								  +"<td>短号</td><td>"+data.shortPhone+"</td></tr>";
						$("#managerTable").html(html);
						if(data.avatar=="img/xx.png"){
							data.avatar="../img/xx.png";
						}
						$("img").attr("src",data.avatar);
					}else{
						layAlert(data.info);
					}
				 }
			   }
			);
		},
		GetDateStr:function(AddDayCount) {
			console.log(AddDayCount);
		    var dd = new Date();
		    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
		    var y = dd.getFullYear();
		    var m = dd.getMonth()+1;//获取当前月份的日期
		    console.log(dd);
		    if(m<10){
		    	m="0"+m;
		    }
		    var d = dd.getDate();
		    if(d<10){
		    	d="0"+d;
		    }
		    return y+"-"+m+"-"+d;
		},
		GetDateTimeStr:function(AddDayCount){
			var dd = new Date();
		    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
		    var y = dd.getFullYear();
		    var M = dd.getMonth()+1;//获取当前月份的日期
		    if(M<10){
		    	M="0"+M;
		    }
		    var H = dd.getHours();//获取当前小时
		    if(H<10){
		    	H = "0"+H;
		    }
		    var m = dd.getMinutes()//获取当前分钟
		    if(m<10){
		    	m = "0"+m;
		    }
		    var s = dd.getSeconds()//获取当前秒钟
		    if(s<10){
		    	s = "0"+s;
		    }
		    var d = dd.getDate();
		    if(d<10){
		    	d="0"+d;
		    } 
		    return y+"-"+M+"-"+d+" "+H+":"+m+":"+s;
		}
}
